<template>
  <div id="up-info" >
    <div class="zhezhao" @click="onSubmit(' ')"></div>
    <div class="up-info-box">
      <div class="item title">{{title}}</div>
      <div class="item">{{desc}}</div>
      <div class="input-box">
        <input type="text" class="input-item" v-model="up_text" placeholder="请输入要更改的内容"/>
            <van-icon name="cross" class="cross-box" v-if="up_text!=''" @click="up_text=''"/>
      </div>
      <div class="button-box">
        <button type="button" :class="(up_text!='' || isEmpty)?'success':''" @click="onSubmit(up_text)">完成</button>
      </div>
    </div>
  </div>
</template>
<script>
import { Icon } from 'vant';
export default {
  name: "up-info",
    components: {
    [Icon.name]: Icon,
  },
  data() {
    return {
      up_text:this.text,//修改的内容
    };
  },

  mounted(){
      console.log(this.text,'---text')
  },
  props:['text','title','desc','isEmpty'],
  methods: {
    //隐藏弹框
    onSubmit(text){
        this.$emit('onSubmit',text)
    },
  },
};
</script>
<style lang="less">
#up-info {
  .zhezhao {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    top: 0;
    left: 0;
    z-index: 100;
  }
  .up-info-box {
    z-index: 101;
    position: absolute;
    background-color: #fff;
    border-radius: 10px;
    top: 30%;
    width: 80%;
    left: 0;
    right: 0;
    margin: 0 auto;
    padding: 20px;
    
    display: flex;
    flex-direction: column;
    align-content: center;
  }
  .button-box{
      margin-top: 20px;
      display: flex;
      justify-content: center;
  }
  .button-box button{
      width: 200px;
      border:0;
      border-radius: 10px;
      height: 40px;
      background-color: #eee;
      color: #999;
  }
.button-box .success{
    background-color: #129611;
    color: #fff;
}

  .item{
      text-align: center;
      font-size: 14px;
      margin: 5px 0px;
      color: #666;
  }
  .title{
      font-weight: 700;
      font-size: 16px;
      margin-bottom: 5px;
        color:#000;
  }
  .input-box{
      display: flex;
      align-content: center;
  }
  .input-item{
      border:1px solid #999;
      border-left: 0;
      border-right: 0;
      border-top: 0;
      margin: 10px 0px;
      width: 100%;
  }
  .cross-box{
    //   position: absolute;
      right: 20px;
      top: 5px;
      border:1px solid #999;
      font-size: 14px;
      background-color: #999;
      color: #fff;
      width: 20px;
      height: 20px;
      text-align: center;
      line-height: 18px;
      border-radius: 20px;

  }
}
</style>